home *** CD-ROM | disk | FTP | other *** search
/ The Trig Explorer / The Trig Explorer.iso / mac / Explorer / plot.dxr / 00129.ls < prev    next >
Encoding:
Text File  |  2000-08-01  |  2.9 KB  |  87 lines

  1. global phase
  2.  
  3. on mouseDown me
  4.   set L0 to the left of sprite 2
  5.   set r0 to the right of sprite 2
  6.   set the floatPrecision to 3
  7.   set the cursor of sprite the spriteNum of me to [member "Closed Hand", member "Closed Hand Mask"]
  8.   repeat while the stillDown
  9.     if (the mouseH < (r0 + 2)) and (the mouseH > (L0 - 2)) then
  10.       set the locH of sprite 3 to the mouseH
  11.       set phase to -90 + float((the locH of sprite 3 - L0) * 0.42899999999999999)
  12.       if integer(phase) > 0 then
  13.         if the hilite of cast "Degrees" then
  14.           put "+" & integer(phase) into field "A"
  15.         else
  16.           set the floatPrecision to 1
  17.           put "+" & phase * PI / 180.0 into field "A"
  18.         end if
  19.       else
  20.         if the hilite of cast "Degrees" then
  21.           put integer(phase) into field "A"
  22.         else
  23.           set the floatPrecision to 1
  24.           put phase * PI / 180.0 into field "A"
  25.         end if
  26.       end if
  27.     end if
  28.     updateStage()
  29.   end repeat
  30.   if value(field "A" = "0") then
  31.     put "+0" into field "A"
  32.   end if
  33. end
  34.  
  35. on mouseUp me
  36.   set the trails of sprite 19 to 1
  37.   set the trails of sprite 20 to 1
  38.   if the foreColor of sprite 19 >= 6 then
  39.     set the foreColor of sprite 19 to 0
  40.   else
  41.     set the foreColor of sprite 19 to the foreColor of sprite 19 + 1
  42.   end if
  43.   set the locV of sprite 19 to 900
  44.   set the foreColor of sprite 20 to 8
  45.   set the cursor of sprite the spriteNum of me to [member "Hand", member "Hand Mask"]
  46.   updateStage()
  47.   set x0 to the locH of sprite 15 + 1
  48.   set y0 to the locV of sprite 15
  49.   repeat with n = 0 to 120
  50.     set the locH of sprite 19 to (2.39999999999999991 * n) + x0
  51.     set the locH of sprite 20 to (2.39999999999999991 * n) + x0
  52.     if the hilite of cast "Sine" then
  53.       set the locV of sprite 19 to y0 - (50.0 * float(sin(((3.0 * n) + phase) * PI / 180.0)))
  54.       set the locV of sprite 20 to y0 - (50.0 * float(sin(n * 3.0 * PI / 180.0)))
  55.       updateStage()
  56.     end if
  57.     if the hilite of cast "Cosine" then
  58.       set the locV of sprite 19 to y0 - (50.0 * float(cos(((3.0 * n) + phase) * PI / 180.0)))
  59.       set the locV of sprite 20 to y0 - (50.0 * float(cos(n * 3.0 * PI / 180.0)))
  60.       updateStage()
  61.     end if
  62.     if the hilite of cast "Tangent" then
  63.       set the locV of sprite 19 to y0 - (50.0 * float(tan(((3.0 * n) + phase) * PI / 180.0)))
  64.       set the locV of sprite 20 to y0 - (50.0 * float(tan(n * 3.0 * PI / 180.0)))
  65.       updateStage()
  66.     end if
  67.     updateStage()
  68.   end repeat
  69.   set the locV of sprite 19 to 900
  70.   set the locV of sprite 20 to 900
  71. end
  72.  
  73. on beginSprite me
  74.   set the cursor of sprite the spriteNum of me to [member "Hand", member "Hand Mask"]
  75.   put "+ 0" into field "A"
  76.   set the hilite of cast "Degrees" to 1
  77.   set the hilite of cast "Radians" to 0
  78.   set the locH of sprite 3 to the left of sprite 2 + 210
  79.   set the hilite of cast "Sine" to 1
  80.   set the hilite of cast "Cosine" to 0
  81.   set the hilite of cast "Tangent" to 0
  82. end
  83.  
  84. on endSprite me
  85.   set the cursor of sprite the spriteNum of me to 0
  86. end
  87.